﻿<Window x:Class="CoreDemoWpf.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="DemoWpf" Height="400" Width="800" Loaded="WindowLoaded"
    xmlns:smc="clr-namespace:SharpMap.Presentation.Wpf;assembly=SharpMap.Presentation.Wpf"
    xmlns:cnv="http://schemas.kent.boogaart.com/converters"
    xmlns:shmp_smp="SharpMap.Presentation"
    xmlns:shmp_ly="clr-namespace:SharpMap.Layers;assembly=SharpMap"
    xmlns:shmp_ctrls="clr-namespace:SharpMap.Wpf;assembly=SharpMap.Wpf"
    xmlns:thm="clr-namespace:SharpMap.Wpf.Thematics;assembly=SharpMap.Wpf"
    xmlns:local="clr-namespace:CoreDemoWpf"
    >
    <Window.Resources>
     <SolidColorBrush x:Key="aBrush" Color="Blue"/>
        
  </Window.Resources>
 

        <DockPanel x:Name="_topPanel" >
    <Menu DockPanel.Dock="Top">
      <MenuItem Header="_File">
        <MenuItem Header="E_xit"/>
      </MenuItem>
            <MenuItem Header="Tools">
                <MenuItem Header="Show Shape Editor..." />
            </MenuItem>
                <MenuItem Header="Tests">
                <MenuItem Header="Diagnoze" Click="MenuItemClick"/>
                <MenuItem Header="Draw PAth" Click="MenuItem_Click_1"/>
            </MenuItem>
        </Menu>
        <ToolBarTray DockPanel.Dock="Top" HorizontalAlignment="Stretch">
            <ToolBar DockPanel.Dock="Top" Height="25">
  
          <ToggleButton x:Name="zoomMouseModeToolStripButton" 
                        Command="{x:Static smc:MapViewCommands.SetActiveTool}" 
                        CommandParameter="{x:Static smc:WpfMapTools.ZoomMouse}"
                        CommandTarget="{Binding ElementName=m_mapView}"
                        IsChecked="{Binding Source={x:Static smc:WpfMapTools.ZoomMouse}, Path=IsActive}"
                        >
            Zoom Mouse
          </ToggleButton>
    
            <ToggleButton x:Name="zoomRectangleModeToolStripButton"                         
                        Command="{x:Static smc:MapViewCommands.SetActiveTool}" 
                        CommandParameter="{x:Static smc:WpfMapTools.ZoomRectangle}"
                        CommandTarget="{Binding ElementName=m_mapView}"
                        IsChecked="{Binding Source={x:Static smc:WpfMapTools.ZoomRectangle}, Path=IsActive}"
                        >
                   Zoom Rectangle
            </ToggleButton>
            <Button x:Name="zoomToExtentsToolsStripButton" 
                    Command="{x:Static smc:MapViewCommands.ZoomToExtents}"
                    CommandTarget="{Binding ElementName=m_mapView}">
                <Image Source="Resources/ZoomToExtents.png"/>
            </Button>
            
             <ToggleButton x:Name="panToolStripButton"                         
                        Command="{x:Static smc:MapViewCommands.SetActiveTool}" 
                        CommandParameter="{x:Static smc:WpfMapTools.Pan}"
                        CommandTarget="{Binding ElementName=m_mapView}"
                        IsChecked="{Binding Source={x:Static smc:WpfMapTools.Pan}, Path=IsActive}"
                        >

                    <Image Source="Resources/pan.png" />
            </ToggleButton>
          <ToggleButton>
            <Image Source="Resources/polygon.png"/>
          </ToggleButton>
            <ToggleButton x:Name="_measureToolStripButton" Click="_measure_Click">Measure</ToggleButton>
            <ToggleButton x:Name="_selectToolStripButton" Click="_select_Click" >Select</ToggleButton>
       </ToolBar>
        </ToolBarTray>
        <shmp_ctrls:MapViewInfoPanel DockPanel.Dock="Bottom" DataContext="{Binding ElementName=m_mapView}"/>
        <Grid x:Name="_grid">
      <Grid.RowDefinitions>
        <RowDefinition Height="0.503410908778876*" />
        <RowDefinition Height="0.496589091221124*" />
       </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="146*" />
        <ColumnDefinition Width="332*" />
      </Grid.ColumnDefinitions>
          
         <Grid Grid.Column="1" Grid.RowSpan="2" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="500*" />
                    <RowDefinition Height="3" />
                    <RowDefinition Height="150*" />
                </Grid.RowDefinitions>
                      <smc:MapView Grid.Row="0" 
                         x:Name="m_mapView"  
                        VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                        />
              
                <GridSplitter Grid.Row="1" ResizeDirection="Rows" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                <DockPanel Grid.Row="2"  Background="White" LastChildFill="True"
                            DataContext="{Binding Mode=TwoWay, ElementName=_layersList, Path=SelectedItem}">
                        <ListView ItemsSource="{Binding}" DockPanel.Dock="Right" DataContext="{Binding SelectedFeatures}" >                        
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="OID" Width="40">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                                <TextBlock Text="{Binding Path=Row.Id}"/>
                                          </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                
                                 <GridViewColumn Header="X" Width="70">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBox ><Binding Path="Row.Geometry.X"/></TextBox>
                                             <!--<TextBox ><Binding Path="Row.Geometry.X" Converter="{cnv:FormatConverter {}{0:n5}}"/></TextBox>-->
                                          </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                
                                 <GridViewColumn Header="Y" Width="70">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBox><Binding Path="Row.Geometry.Y"/></TextBox>
                                            <!--<TextBox><Binding Path="Row.Geometry.Y" Converter="{cnv:FormatConverter {}{0:n5}}"/></TextBox>-->
                                          </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>                              
                        </ListView.View>                  
                        </ListView>
                        <shmp_ctrls:LayerFeaturesTable DockPanel.Dock="Left" x:Name="_layerFeatureTable"
                            ItemsSource="{Binding}" DataContext="{Binding SelectedFeatures}"/>
                 </DockPanel>
            </Grid>

 
            <shmp_ctrls:LayersListView Grid.Row="0" x:Name="_layersList"  
                                    />
        <GridSplitter ResizeDirection="Rows" HorizontalAlignment="Stretch" FlowDirection="LeftToRight" Height="3" VerticalAlignment="Bottom" />
      <DockPanel Grid.Row="1" >
        <smc:LayerStyleView x:Name="_layerStyleView" Layer="{Binding SelectedItem, ElementName=_layersList}"/>
      </DockPanel>
            
        </Grid>
       
    </DockPanel>
</Window>
